package com.neu;

import android.app.Application;
import android.content.Context;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

public class App extends Application {

    public static Context context;
    //Volley的队列
    public static RequestQueue requestQueue;

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        requestQueue = getRequestQueue(context);
    }

    /**
     * 创建队列的方法
     * @param context
     * @return
     */
    private RequestQueue getRequestQueue(Context context) {
        if(requestQueue==null){
            synchronized (RequestQueue.class){
                requestQueue= Volley.newRequestQueue(context);
            }
         }
        return requestQueue;
    }


}
